1. Field of the Invention
The present invention relates to a data processing device such as a microcomputer which is generally incorporated in an electronic device such as a mobile terminal device powered by a battery power supply. The present invention also relates to a power supply switching circuit and a method of controlling a data processing device used in a system capable of receiving power from a plurality of power supplies such as a main power supply and a subordinate power supply. In particular, the present invention relates to a power supply switching circuit for switching a power supply in a data processing device and a method of controlling a data processing device that are used in the power supply switching and controlling process (including data backup process involved in the power supply switching process) when an output voltage level of a power supply falls.
2. Description of the Related Art
In a conventional system including a single power supply, an output voltage level of a power supply is monitored by a detection circuit including a battery voltage reduction detection circuit and an AD converter. When the detection circuit detects a reduction in the output voltage level of the power supply, the system raises an alarm and/or performs power-down processing.
In another conventional system including a plurality of power supplies, the system is normally powered by a main power supply, and when an output voltage level of the main power supply falls, the system switches the power supply so as to be powered by a standby power supply (i.e., a subordinate power supply).
FIG. 1 is a diagram showing a circuit configuration of a conventional microcomputer. The microcomputer shown in FIG. 1 is a system including a plurality of power supplies and switches a power supply for supplying power to an internal circuit of the microcomputer from a main power supply Vmain to a subordinate power supply Vbat when detecting a reduction in the output voltage level of the main power supply Vmain.
Referring to FIG. 1, the microcomputer includes the main power supply Vmain, the subordinate power supply Vbat, a power supply switching circuit 100, and an internal circuit powered through the power supply switching circuit 100 by the main power supply Vmain or the subordinate power supply Vbat. The internal circuit includes a CPU 11, a memory 12, a peripheral circuit (i.e., a peripheral) 13, a bypass capacitor 14, an oscillation circuit (OSC) 15, and a CPU bus 16. The power supply switching circuit 100 includes voltage dividing resistors 4 and 5 (i.e., a voltage dividing resistor circuit), a reference voltage generating circuit 6, a comparator 7, PMOS transistors 8 and 10, and an inverter 9.
In the power supply switching circuit 100, the comparator 7 compares a divided voltage of the main power supply Vmain (i.e., a voltage level NNd of a node Nd) with a reference voltage VNc output from the reference voltage generating circuit 6 (i.e., a voltage level VNc of a node Nc). When the voltage level VNd of the node Nd is higher than the voltage level VNc of the node Nc (i.e., when VNd>VNc), the output of the comparator 7 (i.e., a node Nf) is at “L (low)” level which indicates that the output voltage level of the main power supply Vmain is normal, and the output of the inverter 9 is at “H (high)” level, and hence the PMOS transistor 8 is closed (i.e., turned on) and the PMOS transistor 10 is opened (i.e., turned off). At this time, power is supplied from the main power supply Vmain to an internal power supply node Ne via the PMOS transistor 8 to operate the CPU 11, the memory 12, the peripheral circuit 13, and the oscillation circuit 15, whereas the subordinate power supply Vbat is disconnected from the internal power supply node Ne and hence power is not supplied from the subordinate power supply Vbat to the internal power supply Ne.
In the course of time, the remaining power of the main power supply Vmain decreases, the output voltage level of the main power supply Vmain falls, and then the voltage level VNd of the node Nd becomes not higher than the voltage level VNc of the node Nc (i.e., VNd≦VNc). At this time, the output voltage level of the comparator 7 is brought to “H” level indicating that a reduction in the voltage level of the main power supply Vmain is detected, the output voltage level of the inverter 9 is brought to “L” level, and hence the PMOS transistor 8 is turned off and the PMOS transistor 10 is turned on. Therefore, the main power supply Vmain is disconnected from the internal power supply node Ne and a power supply to the internal power supply node Ne is switched from the main power supply Vmain to the subordinate power supply Vbat, whereby the CPU 11, the memory 12, the peripheral circuit 13, and the oscillation circuit 15 are powered by the subordinate power supply Vbat until the main power supply Vmain is recovered.
In this manner, the microcomputer 100 switches the main power supply Vmain to the subordinate power supply Vbat when a reduction in the voltage level of the main power supply Vmain is detected. Therefore, even when the voltage level of the main power supply Vmain falls and the internal circuit such as the CPU 11 and the memory 12 cannot operate on the main power supply Vmain, the internal circuit can operate on the subordinate power supply Vbat. In other words, the microcomputer 100 is constructed so as to be powered by the subordinate power supply Vbat when the voltage level of the main power supply Vmain falls.
Moreover, the Japanese Patent Application Kokai (Laid-Open) Publication No. 10-243573 discloses another conventional power supply switching circuit that includes two power supplies of a main battery and a backup battery and is intended for elongating the life of the backup battery by preventing the backup battery from being over-charged and over-discharged. The power supply switching circuit operates as follows. A backup battery is charged to a constant voltage by the main battery. When the voltage level of the main battery falls, the backup battery starts discharging (i.e., the backup battery starts supplying power), and when a reduction in the voltage level of the backup battery is detected, the backup battery stops discharging in order to prevent the backup battery from being over-charged and over-discharged.
In the above-described system including a single power supply, the microcomputer controls the battery voltage reduction detecting circuit, the AD converter and so on, detects a reduction in the output voltage level of the power supply, and performs power-down processing and so on. Then, the detection level of a reduction in the voltage level of the power supply needs to be within an operation guaranteeing range in which the operation of elements of the internal circuit is guaranteed and, it is preferable that the detection level is close to the lower limit of the operation guaranteeing range.
However, when a reduction in the voltage level of the power supply is steep, there is a probability that the power-down processing and data backup processing after the detection of a reduction in the voltage level of the power supply is too late to keep data, thereby causing disappearance of data. When the detection level is set at a higher level in order to eliminate this probability, all of the capacity of the main power supply is not used, which becomes uneconomical. In this manner, in the above-described system including a single power supply, it is difficult to set the detection level.
Moreover, in the above-described system including a plurality of power supplies including a main power supply and a subordinate power supply, even when the voltage level of the main power supply becomes lower than the operation guaranteeing range, power is supplied to the system from the subordinate power supply in addition to the main power supply or from only the subordinate power supply. In this system, even when the detection level is set at a level close to the lower limit of the operation guaranteeing range, it is possible to prevent disappearance of data.
However, in many cases, a large-capacity battery including a primary battery such as a dry battery and a secondary battery such as a lithium ion battery is employed. In the mobile terminal device, the reduction in the physical size of the device is required and the subordinate power supply is used only when the voltage level of the main power supply falls and hence the same large-capacity battery as the main power supply is hardly employed as the subordinate power supply. A small-size button battery is employed as the subordinate battery in many cases. However, the capacity of the button battery is smaller than that of the main power supply. Therefore, if the system continuously operates on the button battery in the same manner as the main power supply, the life of the button battery expires in a short time.
Furthermore, in the mobile terminal device, a portion where the button battery of the subordinate power supply is mounted is complex and hence the button battery cannot be taken out simply in many cases. There is also a case where a customer is not allowed to replace the button battery. In these cases, it is not desired that the mobile terminal device is driven by the subordinate power supply for a long time.